package cn.enjoy.listener;

import cn.enjoy.channel.DefaultProcess;
import cn.enjoy.vo.Product;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
//@EnableBinding(Sink.class)
@EnableBinding(DefaultProcess.class)
public class MessageListener {
    //@StreamListener(Sink.INPUT)
    // 增加自定义管道
    @StreamListener(DefaultProcess.INPUT)
    public void input(Message<Product> message) {
        System.err.println("【*** 消息接收 ***】" + message.getPayload());
        System.err.println("【*** 消息接收 heads***】" + message.getHeaders().toString());
    }
}
